<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>命名空间</title>
</head>
<body>
    <script>
        var namespace = {
            a: {
                add: function(a, b) {
                    return a + b;
                }
            },
            b: {
                calculate: function() {
                    return namespace.a.add(1, 2);
                }
            }
        };
    </script>
    <script>
        console.log(namespace.b.calculate());
    </script>
</body>
</html>